/**************************************************
 * esp.cpp
 **************************************************/

#include "esp.h"
#include "main.h"
#include "globals.h"

bool isEspEnabled = false;

void espEnable()
{
	if (!isEspEnabled) {
		isEspEnabled = true;
		WriteMemory(dwChopperBox1, nopTwo, 2);
		WriteMemory(dwChopperBox2, nopTwo, 2);
		WriteMemory(dwChopperBox3, nopTwo, 2);
		WriteMemory(dwColdBloodedFix, nopTwo, 2);
		WriteMemory(dwNameTag1, nopSix, 6);
		WriteMemory(dwNameTag2, nopSix, 6);
		WriteMemory(dwNameTag3, nopSix, 6);
		WriteMemory(dwNameTag4, nopSix, 6);
		WriteMemory(dwNameTag5, nopSix, 6);
		WriteMemory(dwDrawThroughWalls, nopTwo, 2);
	}
}

void espDisable()
{
	if (isEspEnabled) {
		isEspEnabled = false;
		WriteMemory(dwChopperBox1, bChopperBox1, 2);
		WriteMemory(dwChopperBox2, bChopperBox2, 2);
		WriteMemory(dwChopperBox3, bChopperBox3, 2);
		WriteMemory(dwColdBloodedFix, bColdBloodedFix, 2);
		WriteMemory(dwNameTag1, bNameTag1, 6);
		WriteMemory(dwNameTag2, bNameTag2, 6);
		WriteMemory(dwNameTag3, bNameTag3, 6);
		WriteMemory(dwNameTag4, bNameTag4, 6);
		WriteMemory(dwNameTag5, bNameTag5, 6);
		WriteMemory(dwDrawThroughWalls, bDrawThroughWalls, 2);
	}
}

void espToggle()
{
	if (isEspEnabled)
		espDisable();
	else
		espEnable();
}